import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { earlyWarningQuery, IModelDataQuery } from './types';

/**
 * 监测预警
 *  */

//左侧数据接口
export function getLeftData(query: earlyWarningQuery): AxiosPromise<any> {
  return request({
    url: `/largescreen/api/largeScree/getLeftData`,
    method: 'get',
    params: query
  });
}

export function getRightData(query: earlyWarningQuery): AxiosPromise<any> {
  return request({
    url: `/largescreen/api/largeScree/getRightData`,
    method: 'get',
    params: query
  });
}

//地图点位点击的弹出框信息
export function getPointInfo(query) {
  return request({
    url: `/largescreen/api/resource/info`,
    method: 'get',
    params: query
  });
}

//获取配置key
export function configKey(key: string) {
  return request({
    url: `/largescreen/api/largeScree/configKey/${key}`,
    method: 'get'
  });
}

// 获取设备标签
export function getClassify() {
  return request({
    url: `/largescreen/api/largeScree/getClassify`,
    method: 'get'
  });
}

//获取智能分析
export function getModelData(query: IModelDataQuery) {
  return request({
    url: '/largescreen/api/largeScree/getNewModelData',
    method: 'get',
    params: query
  });
}

//入户监测列表
export function getHouseholdMonitoring(query) {
  return request({
    url: `/largescreen/api/largeScree/getHouseholdMonitoring`,
    method: 'get',
    params: query
  });
}

//入户检测操作按钮报警接口
export function getHouseholdMonitoringAlarm(query) {
  return request({
    url: `/largescreen/api/largeScree/getHouseholdMonitoringAlarm`,
    method: 'get',
    params: query
  });
}

// 查询隐患类别分析（柱状图）
export function category(query) {
  return request({
    url: '/hyjg/pitfallStatistics/category',
    method: 'get',
    params: query
  });
}

//隐患整改状态
export function categoryAnalysis(query?) {
  return request({
    url: '/hyjg/pitfallStatistics/categoryAnalysis',
    method: 'get',
    params: query
  });
}

// 查询隐患管理列表
export function listPitfall(query) {
  return request({
    url: '/hyjg/pitfall/list',
    method: 'get',
    params: query
  });
}

// 隐患分布
export function getStatisticByCompany(query?) {
  return request({
    url: '/hyjg/pitfallStatistics/getStatisticByCompany',
    method: 'get',
    params: query
  });
}

// 周边监控
export function monitorAlarm(data) {
  return request({
    url: '/largescreen/alarm/round',
    method: 'post',
    data
  });
}

// 根据参数键名查询参数值
export function getConfigKey(configKey) {
  return request({
    url: '/system/config/configKey/' + configKey,
    method: 'get'
  });
}

// 报警数量趋势分析（折线图）(给首页用的从命名一下)
export function lineTrendIndex(query) {
  return request({
    url: '/largescreen/alarm/trend',
    method: 'get',
    params: query
  });
}

//城市排名
export function getAlarmByCounty(query?) {
  return request({
    url: '/largescreen/api/largeScree/getAlarmByCounty',
    method: 'get',
    params: query
  });
}

//获取电子围栏列表
export function getElectronicFenceList(query) {
  return request({
    url: '/largescreen/videoMonitoringProjectDetails/count',
    method: 'get',
    params: query
  });
}

//根据code获取电子围栏详情
export function getElectronicFenceInfo(query) {
  return request({
    url: '/largescreen/videoMonitoringProjectDetails/monitoringCode',
    method: 'get',
    params: query
  });
}
